Skip to content

Conversation

stanley2058
Copy link
Collaborator

Move worker duty into socket io server.

Pros:

  • No unnecessary Redis stream
    • The current worker is based on a polling mechanism, which leads to inefficiency
    • Now we don't have to recreate the ydoc in different places several times
  • Reactive stream processing
    • Now Redis stream operations for room happen only on update instead of worker polling
    • No pending task and stream entry accumulation

Cons:

  • Pressure on socket io server would be higher
  • Due to caching, expected memory usage would be higher

Others:

  • Implementing heavy caching in the server to avoid unnecessary operation as much as possible
    • Authentication result is now cached for 1m
    • Server now maintains a copy of ydoc

@stanley2058 stanley2058 marked this pull request as ready for review January 22, 2025 07:59
@stanley2058 stanley2058 force-pushed the expr/disable-worker branch 2 times, most recently from ad99461 to adb38bd Compare January 22, 2025 13:35
@stanley2058
Copy link
Collaborator Author

Please try to handle SIGTERM, SIGINT, SIGQUIT and uncaughtException, unhandledRejection. Some message from worker and std output should be logged in order to debug.

Due to storage not being managed here, the worker is created externally and passed in. Thus, status handling should also be handled externally where the worker is created.

@jackycute jackycute requested a review from Yukaii January 23, 2025 05:43
@Yukaii Yukaii merged commit c1d038a into main Jan 23, 2025
1 check passed
@Yukaii Yukaii deleted the expr/disable-worker branch January 23, 2025 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants